package com.myidis.servlet;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myidis.entity.RightUserGroupRole;
import com.myidis.mapper.RightUserGroupRoleMapper;

@Service
public class RightUserGroupRoleServlet {
	@Autowired
	private RightUserGroupRoleMapper rightUserGroupRoleMapper;
	
	public List<RightUserGroupRole> all() {
		return rightUserGroupRoleMapper.all();
	}
	
	public RightUserGroupRole getOne(int id) {
		return rightUserGroupRoleMapper.getOne(id);
	}
	
	public int insert(RightUserGroupRole obj) {
		return rightUserGroupRoleMapper.insert(obj);
	}
	
	public int insert(List<RightUserGroupRole> objs) {
		int count = 0;
		for (RightUserGroupRole obj: objs) {
			System.out.println(obj.toString());
			count += rightUserGroupRoleMapper.insert(obj);
		}
		return count;
	}
	
	public int update(RightUserGroupRole obj) {
		return rightUserGroupRoleMapper.update(obj);
	}
	
	public int delete(int id) {
		return rightUserGroupRoleMapper.delete(id);
	}
	
	public int delete(int[] ids) {
		int count = 0;
		for(int i = 0; i < ids.length; i++)
			count += rightUserGroupRoleMapper.delete(ids[i]);
		return count;
	}
}
